package cn.tutu.shop.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;

import cn.tutu.blockchain.common.Page;
import cn.tutu.shop.dao.ProductDao;
import cn.tutu.shop.entity.Product;
import cn.tutu.shop.service.ProductService;

@Service
public class ProductServiceImpl implements ProductService {

	@Autowired
	private ProductDao productDao;

	@Override
	public PageInfo<Product> getAll(Page page) {
		PageHelper.startPage(page.getPageNum(), page.getPageSize());
		List<Product> list = productDao.findAll();
		PageInfo<Product> pageInfo = new PageInfo<Product>(list);
		return pageInfo;
	}

}
